<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>



<%@ page import="java.util.*,shcool.dao.*,java.sql.*,school.entity.*,java.sql.Date" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'doReg.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
  <%
  request.setCharacterEncoding("utf-8");
  
  String sname=request.getParameter("stuname");
  String pass=request.getParameter("pass");
  
  String sex=request.getParameter("sex");
  
	
	  String telephone=request.getParameter("tele");
	  String qq=request.getParameter("qq");
	  String wechat=request.getParameter("wechat");
	  int gradeid=Integer.parseInt(request.getParameter("gradeId"));
		String eyear = request.getParameter("eyear");
		String emonth = request.getParameter("emonth");
		String edate = request.getParameter("edate");
		
		String endate=eyear+"-"+emonth+"-"+edate;
		Date enterdate = Date.valueOf(endate);
		
		 String fromcity=request.getParameter("city");
		 
			String byear = request.getParameter("byear");
			String bmonth = request.getParameter("bmonth");
			String bdate = request.getParameter("bdate");
			
		
			String birth=byear+"-"+bmonth+"-"+bdate;
			Date birthday = Date.valueOf(birth);
			
			
		 String address=request.getParameter("address");
			StudentDao dao = new MySqlStudentDaoImpl();
			

			
		Student st =new Student(gradeid,sname,sex,telephone,qq,wechat,fromcity,address,enterdate,birthday,pass);

			dao.add(st);

			out.println("添加学生成功");	
		
  %>
  

    
  </body>
</html>
